//	@file Version: 1.0
//	@file Name: ADP_F_fillItems.sqf
//	@file Author: THumbert
//	@file Created: 12/14/2013
//	@file Description: Fills listbox with Misc items

#define KINDOF_ARRAY(a,b) [##a,##b] call {_veh = _this select 0;_types = _this select 1;_res = false; {if (_veh isKindOf _x) exitwith { _res = true };} forEach _types;_res}
private ["_kindOf","_filter"];
disableSerialization;
_disp = _this select 0;
_control = _this select 1;
_type = _this select 2;
_display = findDisplay _disp;
_ctrl = _display displayctrl _control;
_Listbox = _control;

_kindOf = ["Static"]; _filter = [
"Weapon_Bag_Base","ReammoBox","LandVehicle","Man",
"Air","Ship","Logic","MineBase","placed_chemlight_green",
"Rope","placed_B_IR_grenade","Thing","ArtilleryTarget"];

lbClear _Listbox;
hint "Adding Misc";
_cfgvehicles = configFile >> "cfgVehicles";
for "_i" from 0 to (count _cfgvehicles)-1 do {
	_vehicle = _cfgvehicles select _i;
	if (isClass _vehicle) then {
		_veh_type = configName(_vehicle);
		if ((getNumber(_vehicle >> "scope")>=1)and(KINDOF_ARRAY(_veh_type,_kindOf))) then {
			if (KINDOF_ARRAY(_veh_type,_filter))exitWith {};
			_Text = (getText(_vehicle >> "displayName"));
			if ((_Text == "")||(_Text == "Unknown")) exitWith {};
			_index = lbAdd [_ListBox, _Text];
			lbSetData [_listbox,_index,_veh_type];
			lbSetValue [_listbox, _index,_type];
			
		};
	};
};
lbsort _ctrl;
